package view.teacher;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import view.common.ChangepassInterfrm;
import view.manager.ModifyInfoInterfrm;

import javax.swing.BoxLayout;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JDesktopPane;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class TeacherMainFrm extends JFrame {

	private JPanel contentPane;
	private JDesktopPane desktopPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TeacherMainFrm frame = new TeacherMainFrm();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public TeacherMainFrm() {
		setTitle("学生成绩管理系统教师端");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 983, 566);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnNewMenu = new JMenu("个人中心");
		mnNewMenu.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/person.png")));
		menuBar.add(mnNewMenu);
		
		JMenuItem mntmNewMenuItem = new JMenuItem("修改个人资料");
		mntmNewMenuItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ModifyInfoInterfrm modifyInfoInterfrm = new ModifyInfoInterfrm();
				modifyInfoInterfrm.setVisible(true);
				desktopPane.add(modifyInfoInterfrm);
			}
		});
		mntmNewMenuItem.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/modify.png")));
		mnNewMenu.add(mntmNewMenuItem);
		
		JMenuItem mntmNewMenuItem_1 = new JMenuItem("修改密码");
		mntmNewMenuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ChangepassInterfrm changepassInterfrm = new ChangepassInterfrm();
				changepassInterfrm.setVisible(true);
				desktopPane.add(changepassInterfrm);
			}
		});
		mntmNewMenuItem_1.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/modify_pass.png")));
		mnNewMenu.add(mntmNewMenuItem_1);
		
		JMenuItem mntmNewMenuItem_2 = new JMenuItem("退出系统");
		mntmNewMenuItem_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				int res = JOptionPane.showConfirmDialog(null, "是否退出系统");
				if (res == 0) {
					dispose();
				}
			}
		});
		mntmNewMenuItem_2.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/exit.png")));
		mnNewMenu.add(mntmNewMenuItem_2);
		
		JMenu mnNewMenu_2 = new JMenu("学生");
		mnNewMenu_2.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/学生.png")));
		menuBar.add(mnNewMenu_2);
		
		JMenuItem mntmNewMenuItem_5 = new JMenuItem("查看学生信息");
		mntmNewMenuItem_5.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				SeeStudentInfoInterfrm seeStudentInfoInterfrm = new SeeStudentInfoInterfrm();
				seeStudentInfoInterfrm.setVisible(true);
				desktopPane.add(seeStudentInfoInterfrm);
			}
		});
		mntmNewMenuItem_5.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/总人数.png")));
		mnNewMenu_2.add(mntmNewMenuItem_5);
		
		JMenu mnNewMenu_3 = new JMenu("课程");
		mnNewMenu_3.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/课程表.png")));
		menuBar.add(mnNewMenu_3);
		
		JMenuItem mntmNewMenuItem_6 = new JMenuItem("我的课程");
		mntmNewMenuItem_6.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				MyCourseInterfrm myCourseInterfrm = new MyCourseInterfrm();
				myCourseInterfrm.setVisible(true);
				desktopPane.add(myCourseInterfrm);
			}
		});
		mntmNewMenuItem_6.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/课程表.png")));
		mnNewMenu_3.add(mntmNewMenuItem_6);
		
		JMenu mnNewMenu_1 = new JMenu("成绩");
		mnNewMenu_1.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/成绩管理.png")));
		menuBar.add(mnNewMenu_1);
		
		JMenuItem mntmNewMenuItem_3 = new JMenuItem("成绩录入");
		mntmNewMenuItem_3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ScoreEentryInterfrm scoreEentryInterfrm = new ScoreEentryInterfrm();
				scoreEentryInterfrm.setVisible(true);
				desktopPane.add(scoreEentryInterfrm);
			}
		});
		mntmNewMenuItem_3.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/报表数据录入.png")));
		mnNewMenu_1.add(mntmNewMenuItem_3);
		
		JMenuItem mntmNewMenuItem_4 = new JMenuItem("成绩管理");
		mntmNewMenuItem_4.setIcon(new ImageIcon(TeacherMainFrm.class.getResource("/images/成绩管理 (1).png")));
		mnNewMenu_1.add(mntmNewMenuItem_4);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		
		desktopPane = new JDesktopPane();
		contentPane.add(desktopPane, BorderLayout.CENTER);
		setExtendedState(JFrame.MAXIMIZED_BOTH);
	}
}
